Welcome Guest | Sign in | Register
Windows Controls - DotNet Programming Interview Questions and Answers | LucentBlackBoard | LucentBlackBoard.com

Home > Technical Interviews > Computer Science & Engineering > DotNet Programming > Windows Controls Questions and Answers

66. How can you enforce a text box to display characters in uppercase?

The TextBox class contains the CharacterCasing property, which is used to specify the case of the content for a text box. This property accepts a value from the CharacterCasing enumeration of .NET Framework. The members specified in the CharacterCasing enumeration are Lower, Upper, and Normal. You can select any one of these enumerations as a value for the CharacterCasing property of a specified text box, as shown in the following code snippet:

textBox1.CharacterCasing = CharacterCasing.Upper;

67. Is it possible to associate a control with more than one ContextMenu?

No, we cannot associate a control with more than one ContextMenu.

68. How can you check/uncheck all items in the CheckedListBox control in .NET 4.0?

To check all items in .NET, you can use the following code snippet:

Code for VB:
Dim i as Integer
For i = 0 To myCheckedListBox.Items.Count - 1
myCheckedListBox.SetItemChecked(i, True)
Next

Code for C#:
for( int i = 0; i < myCheckedListBox.Items.Count; i++ )
{
myCheckedListBox.SetItemChecked(i, true);
}

69. How can we disable the context menu for a TextBox control?

The TextBox class contains the ContextMenuStrip property. When we set this property to a dummy instance of the ContextMenu class, the TextBox control is unable to provide any context menu on the right-click of the mouse.

70. How can you move and resize a control on a Windows form?

You can make use of the SetBounds() method to move as well as resize the control on a Windows form.




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.